package com.xiaoyu.awakening.gateway.enums;

import org.springframework.http.HttpStatus;

/**
 * token 登录校验状态
 *
 * @author wangxiaoyu
 * @since v1.0
 */
public enum TokenLoginValidateStatus implements ITokenValidate {
    // token 过期
    TOKEN_EXPIRE(1, HttpStatus.UNAUTHORIZED.value(), "token", ""),
    // token 被踢出
    TOKEN_KICKED_OUT(2, HttpStatus.UNAUTHORIZED.value(), "invalid token", ""),
    TOKEN_LOGIN_VERIFY_OK(3, HttpStatus.OK.value(), "", ""),
    TOKEN_LOGIN_VERIFY_DEFAULT_ERROR(4, HttpStatus.BAD_GATEWAY.value(), "invalid token", "");

    private final Integer validateStatus;
    private final Integer httpStatus;
    private final String cause;
    private final String details;

    TokenLoginValidateStatus(Integer validateStatus, Integer httpStatus, String cause, String details) {
        this.validateStatus = validateStatus;
        this.httpStatus = httpStatus;
        this.cause = cause;
        this.details = details;
    }

    @Override
    public Integer getValidateStatus() {
        return this.validateStatus;
    }

    @Override
    public Integer getHttpStatus() {
        return this.httpStatus;
    }

    @Override
    public String getCause() {
        return this.cause;
    }

    @Override
    public String getDetail() {
        return this.details;
    }

    @Override
    public String getPhase() {
        return "TOKEN_LOGIN_VALIDATE";
    }
}
